import { ref } from "vue"
import { defineStore } from "pinia"
export const useAppStore = defineStore("app", () => {
    const cindex = ref<number>(0)
    const title = ref<string | null>("")
    const isLoading = ref<boolean>(false)
    const getCindex = () => cindex.value
    const getTitle = () => title.value
    const getIsLoading = () => isLoading.value
    const changeIndex = (index: number) => {
        cindex.value = index
    }
    const changeIsLoading = (b: boolean) => {
        isLoading.value = b
    }
    const changeTitle = (ptitle: string) => {
        title.value = ptitle
    }
    return { getCindex, getTitle, changeTitle, changeIndex, changeIsLoading, getIsLoading, };
})
// import { storeToRefs } from 'pinia';
// const { count } = storeToRefs(appStore);
// import { useAppStore } from '@/store/useAppStore';

// // setup composition API模式
// const appStore = useAppStore();

// const { increment, doubleCount } = counterStoreForSetup;